<template>
    <s-layout id="layout" :title="'入职申请'" navbar="normal" leftIconColor="#ffffff" :autoBack="true" :bgColor="'rgba(0,0,0,0)'" :tabbarshow='false' :titleStyle="{ color: '#ffffff', fontSize: '32rpx',fontWeight:'600' }">
        <!-- 最大盒子 -->
        <view class="container" :style="{ backgroundImage: `url( ${baseUrl}/uploads/uniapp_image/staff/staff_project_arrange.png)`,paddingTop:(safeAreaInsets?.top + 44) + 'px'}">
            <view class="area form_box">
               
                <scroll-view scroll-y style="height: 74vh;" :enable-back-to-top="true">
                    <view v-if="nextFormRules ==  1">
                        <view class="form_title_box">
                            <view class="form_pages">{{ nextFormRules }}/4</view>
                            <view class="form_title">基本信息</view>
                        </view>
                        <u--form labelPosition="left" :model="FormData" :rules="rules" ref="formRole" :borderBottom="false">
                        <!-- 政治面貌 -->
                        <u-form-item :required="true" :borderBottom="false" :labelWidth="100" label="政治面貌：" prop="political_status" ref="political_status" @tap="political_status_open">
                            <u--input disabled :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请选择政治面貌" v-model="political_status_title" border="none"></u--input>
                        </u-form-item>
                        <u-form-item :required="true" :borderBottom="false" :labelWidth="100" label="户籍类型：" prop="hukou_type" ref="hukou_type" @tap="huokou_type_open">
							<u--input disabled :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请选择户籍类型" v-model="id_Type" border="none"></u--input>
                        </u-form-item>
                        <!-- 现住址 -->
                        <u-form-item :required="true" :borderBottom="false" :labelWidth="100" label="现住址" prop="address" ref="address">
                            <u--input :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请输入详细地址" v-model="FormData.address" border="none"></u--input>
                        </u-form-item>
                        <!-- 籍贯 -->
                        <u-form-item :borderBottom="false" :labelWidth="100" label="籍贯：" prop="nativ_place" ref="nativ_place">
                            <u--input :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请输入籍贯" v-model="FormData.nativ_place" border="none"></u--input>
                        </u-form-item>
                        <!-- 户口所在地 -->
                        <u-form-item :borderBottom="false" :labelWidth="100" label="户口所在地：" prop="householdaddress" ref="householdaddress">
                            <u--input :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请输入户口所在地" v-model="FormData.householdaddress" border="none"></u--input>
                        </u-form-item>
                        <!-- 婚姻状况 -->
                        <u-form-item :borderBottom="false" :labelWidth="100" label="婚姻状况：" prop="marital_status" ref="marital_status" @tap="marital_status_open">
                            <u--input disabled :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请选择婚姻状况" v-model="marital_status_title" border="none"></u--input>
                        </u-form-item>
                        
                        <!-- 毕业院校 -->
                        <u-form-item :borderBottom="false" :labelWidth="100" label="毕业院校：" prop="graduate_school" ref="graduate_school">
                            <u--input :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请输入毕业院校" v-model="FormData.graduate_school" border="none"></u--input>
                        </u-form-item>
                        <!-- 最高学历 -->
                        <u-form-item v-if="FormData.graduate_school" :borderBottom="false" :labelWidth="100" label="最高学历：" prop="education" ref="education" @tap="education_open">
                            <u--input disabled :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请选择最高学历" v-model="FormData.education" border="none"></u--input>
                        </u-form-item>
                        <!-- 专业 -->
                        <u-form-item v-if="FormData.graduate_school" :borderBottom="false" :labelWidth="100" label="专业：" prop="major" ref="major">
                            <u--input :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请输入专业" v-model="FormData.major" border="none"></u--input>
                        </u-form-item>
                        <!-- 毕业日期 -->
                        <u-form-item v-if="FormData.graduate_school" :borderBottom="false" :labelWidth="100" label="毕业日期：" prop="graduation_date" ref="graduation_date" @tap="graduation_date_open">
                            <u--input disabled :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请选择毕业日期" v-model="FormData.graduation_date" border="none"></u--input>
                        </u-form-item>
                      
                    </u--form>
                    <s-button @netWork="nextForm" :text="'下一步'" />
                    </view>
                    <!-- 下一步内容  紧急联系人 -->
                     <view v-if="nextFormRules == 2">
                        <view class="form_title_box">
                            <view class="form_pages">{{ nextFormRules }}/4</view>
                            <view class="form_title">紧急联系人</view>
                        </view>
                        <u--form labelPosition="left" :model="FormNextData" :rules="nextRules" ref="formNextRole" :borderBottom="false" labelWidth="280rpx">
                        
                         <!-- 紧急联系人 -->
                         <u-form-item :required="true" :borderBottom="false" :labelWidth="150" label="紧急联系人：" prop="emergency_contact" ref="emergency_contact">
                            <u--input :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请输入紧急联系人" v-model="FormNextData.emergency_contact" border="none"></u--input>
                        </u-form-item>
                        <!-- 紧急联系人关系 -->
                        <u-form-item :required="true" :borderBottom="false" :labelWidth="150" label="紧急联系人关系：" prop="emergency_contact_relation" ref="emergency_contact_relation">
                            <u--input :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请输入紧急联系人关系" v-model="FormNextData.emergency_contact_relation" border="none"></u--input>
                        </u-form-item>
                         <!-- 紧急联系人电话 -->
                         <u-form-item :required="true" :borderBottom="false" :labelWidth="150" label="联系人电话：" prop="emergency_contact_mobile" ref="emergency_contact_mobile">
                            <u--input :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="number" placeholder="请输入紧急联系人电话" v-model="FormNextData.emergency_contact_mobile" border="none"></u--input>
                        </u-form-item>
                        <u-form-item :required="true" :borderBottom="false" :labelWidth="150" label="紧急联系人地址：" prop="emergency_contact_address" ref="emergency_contact_address">
                            <u--input :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请输入紧急联系人地址" v-model="FormNextData.emergency_contact_address" border="none"></u--input>
                        </u-form-item>
                        </u--form>
                    
                        <s-button @leftNetWork="nextBackTowForm" @rightNetWork="nextTowForm"  :leftWidth="'30%'" :rightWidth="'70%'" :type="'twobutton'" :oneText="'上一步'" :twoText="'下一步'" />
                     </view>
                 <!-- 健康状况 -->
                    <view v-if="nextFormRules == 3" class="long_form">
                        <view class="form_title_box">
                            <view class="form_pages">{{ nextFormRules }}/4</view>
                            <view class="form_title">健康状况</view>
                        </view>
                        <u--form labelPosition="left" :model="FormNextTwoData" :rules="nextTwoRules" ref="formNextTwoRole" :borderBottom="false" >
                         <!-- 身高 -->
                            <u-form-item :borderBottom="false" :labelWidth="100" label="身高：" prop="height" ref="height">
                                <u--input :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请输入身高" v-model="FormNextTwoData.height" border="none"></u--input>
                            </u-form-item>
                        <!-- 体重 -->
                            <u-form-item :borderBottom="false" :labelWidth="100" label="体重：" prop="weight" ref="weight">
                                <u--input :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请输入体重" v-model="FormNextTwoData.weight" border="none"></u--input>
                            </u-form-item>
                         <!-- 视力 -->
                            <u-form-item :required="true" :borderBottom="false" :labelWidth="160" label="视力：" prop="eyesight" ref="eyesight">
                                <u-radio-group v-model="FormNextTwoData.eyesight">
                                    <u-radio
                                        :customStyle="{marginRight: '16px'}"
                                        v-for="(item, index) in eyesight_columns"
                                        :key="index"
                                        :label="item.name"
                                        :name="item.value"
                                    >
                                    </u-radio>
                                </u-radio-group>
                            </u-form-item>  
                        <!-- 听力 -->
                        <u-form-item :required="true" :borderBottom="false" :labelWidth="160" label="听力：" prop="hearing" ref="hearing">
                                <u-radio-group v-model="FormNextTwoData.hearing">
                                    <u-radio
                                        :customStyle="{marginRight: '16px'}"
                                        v-for="(item, index) in hearing_columns"
                                        :key="index"
                                        :label="item.name"
                                        :name="item.value"
                                    >
                                    </u-radio>
                                </u-radio-group>
                            </u-form-item>  
                        <!-- 是否有残疾证明 -->
                        <u-form-item :required="true" class="" :borderBottom="false" :labelWidth="360" label="是否曾被认定为工伤或职业病或持有残疾人证明 ：填写“是”或“否" prop="is_occupational_injury  " ref="is_occupational_injury  ">
                                <u-radio-group v-model="FormNextTwoData.is_occupational_injury  ">
                                    <u-radio
                                        :customStyle="{marginRight: '16px'}"
                                        v-for="(item, index) in is_occupational_injury_columns"
                                        :key="index"
                                        :label="item.name"
                                        :name="item.value"
                                       
                                    >
                                    </u-radio>
                                </u-radio-group>
                              
                        </u-form-item>  
                            <!-- 是否被劳动能力鉴定委员会委员会鉴定为具有伤残等级以及何级伤残：填写“是”或“否”以及伤残等级  -->
                        <u-form-item :required="true"  class="" :borderBottom="false" :labelWidth="360" label="是否被劳动能力鉴定委员会委员会鉴定为具有伤残等级以及何级伤残：填写“是”或“否”以及伤残等级 ：填写“是”或“否" prop="is_disability  " ref="is_disability  ">
                            <view class="displayflex">   
                            <u-radio-group v-model="FormNextTwoData.is_disability  ">
                                    <u-radio
                                        :customStyle="{marginRight: '16px'}"
                                        v-for="(item, index) in is_disability_columns"
                                        :key="index"
                                        :label="item.name"
                                        :name="item.value"
                                         @change="injury_select(item)"
                                    >
                                    </u-radio>
                                </u-radio-group>
                                <view class="add_name"  v-if="injury_show_input" @tap="choose_injury" >
                                    <view v-if="!FormNextTwoData.disability_level" >请选择伤残等级</view>
                                    <view v-else>{{FormNextTwoData.disability_level}}级</view>
                                </view>
                            </view>
                        </u-form-item>  
                               <!-- 是否从事过井下、高空、高温、特别繁重体力劳动已经有毒有害工种：填写“是”或“否”  -->
                        <u-form-item :required="true"  class="" :borderBottom="false" :labelWidth="360" label="是否从事过井下、高空、高温、特别繁重体力劳动已经有毒有害工种：填写“是”或“否” " prop="is_high_risk" ref="is_high_risk  ">
                            <u-radio-group v-model="FormNextTwoData.is_high_risk">
                                <u-radio
                                    :customStyle="{marginRight: '16px'}"
                                    v-for="(item, index) in is_high_risk_columns"
                                    :key="index"
                                    :label="item.name"
                                    :name="item.value"
                                   
                                >
                                </u-radio>
                            </u-radio-group>
                            
                        </u-form-item>  
                        <!-- 是否有传染性疾病以及何疾病：填写“是”或“否”以及何疾病：  -->
                        <u-form-item :required="true"  class="" :borderBottom="false" :labelWidth="360" label="是否有传染性疾病以及何疾病：填写“是”或“否”以及何疾病" prop="is_contagion  " ref="is_contagion  ">
                           
                            <u-radio-group v-model="FormNextTwoData.is_contagion  ">
                                    <u-radio
                                        :customStyle="{marginRight: '16px'}"
                                        v-for="(item, index) in is_contagion_columns"
                                        :key="index"
                                        :label="item.name"
                                        :name="item.value"
                                        @change="risk_select(item)"
                                    >
                                    </u-radio>
                                </u-radio-group>
                                <view class="add_name"  v-if="risk_show_input" >
                                    <u--input :clearable="false"  :placeholderStyle="{color:'#fff'}"  inputAlign="right" type="text" placeholder="请输入内容" v-model="FormNextTwoData.contagion_detail" border="none"></u--input>
                                </view>
                             
                        </u-form-item> 
                        <!-- 最近6个月内所接受的医学治疗与医学检查： -->
                            <u-form-item :required="true" :borderBottom="false" :labelWidth="360" label="最近6个月内所接受的医学治疗与医学检查" prop="recent_inspection" ref="recent_inspection">
                                <up-textarea :placeholderStyle="{color:'#8080a1',fontSize:'26rpx'}" height="80" v-model="FormNextTwoData.recent_inspection" placeholder="请输入最近6个月内所接受的医学治疗与医学检查,没有则填无" border="none"></up-textarea>
                            </u-form-item>
                        </u--form>
                        <s-button @leftNetWork="nextBackThreeForm" @rightNetWork="nextThreeForm"  :leftWidth="'30%'" :rightWidth="'70%'" :type="'twobutton'" :oneText="'上一步'" :twoText="'下一步'" />
                    </view>
                      <!-- 下一步内容  紧急联系人 -->
                      <view v-if="nextFormRules == 4" class="long_two_form">
                        <view class="form_title_box">
                            <view class="form_pages">{{ nextFormRules }}/4</view>
                            <view class="form_title">前用人单位信息</view>
                        </view>
                        <u--form labelPosition="left" :model="FormNextFourData" :rules="nextFourRules" ref="formNextFourRole" :borderBottom="false" >
                            <!-- 离职时间： -->
                            <u-form-item :borderBottom="false" :labelWidth="100" label="离职时间：" prop="resignation_time" ref="resignation_time" @tap="lz_re_time_open" >
                                <u--input disabled :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请选择离职时间" v-model="FormNextFourData.resignation_time" border="none"></u--input>
                            </u-form-item>
                            <!-- 离职原因： -->
                            <u-form-item :borderBottom="false" :labelWidth="100" label="离职原因：" prop="reason_to_leave" ref="reason_to_leave" >
                                <u--input :clearable="false" disabledColor="rgba(0,0,0,0)" inputAlign="right" type="text" placeholder="请输入离职原因" v-model="FormNextFourData.reason_to_leave" border="none"></u--input>
                            </u-form-item>
                             <!-- 是与前用人单位约定了保密协议与竞业限制条款：填写“是”或“否 -->
                             <u-form-item :required="true" :borderBottom="false" :labelWidth="360" label="是与前用人单位约定了保密协议与竞业限制条款：填写“是”或“否”" prop="is_confidentiality_agreement  " ref="is_confidentiality_agreement  ">
                                <u-radio-group v-model="FormNextFourData.is_confidentiality_agreement">
                                    <u-radio
                                        :customStyle="{marginRight: '16px'}"
                                        v-for="(item, index) in is_confidentiality_agreement_columns"
                                        :key="index"
                                        :label="item.name"
                                        :name="item.value"
                                    >
                                    </u-radio>
                                </u-radio-group>
                            </u-form-item>
                             <!-- 是否与前用人单位有未尽的法律事宜：填写“是”或“否” -->
                             <u-form-item :required="true" :borderBottom="false" :labelWidth="360" label="是否与前用人单位有未尽的法律事宜：填写“是”或“否”" prop="is_legal_dispute" ref="is_legal_dispute">
                                <u-radio-group v-model="FormNextFourData.is_legal_dispute">
                                    <u-radio
                                        :customStyle="{marginRight: '16px'}"
                                        v-for="(item, index) in is_legal_dispute_columns"
                                        :key="index"
                                        :label="item.name"
                                        :name="item.value"
                                    >
                                    </u-radio>
                                </u-radio-group>
                            </u-form-item>
                        </u--form>
                    
                        <s-button @leftNetWork="nextBackFourForm" @rightNetWork="nextFourForm"  :leftWidth="'30%'" :rightWidth="'70%'" :type="'twobutton'" :oneText="'上一步'" :twoText="'确认'" />
                     </view>
                </scroll-view>
            </view>
        </view>

    </s-layout>


    <!-- 所有弹出框 顺序从上到下 -->
    <!-- 婚姻状况 -->
    <up-picker :closeOnClickOverlay="true" :show="marital_status_show" :columns="marital_status_columns" :title="'请选择婚姻状况'" @confirm="marital_status_confirm" @cancel="marital_status_cancel" @close="marital_status_close"></up-picker>
    <!-- 政治面貌 -->
    <up-picker :closeOnClickOverlay="true" :show="political_status_show" :columns="political_status_columns" :title="'请选择政治面貌'" @confirm="political_status_confirm" @cancel="political_status_cancel" @close="political_status_close"></up-picker>
    <!-- 最高学历 -->
    <up-picker :closeOnClickOverlay="true" :show="education_show" :columns="education_columns" :title="'请选择最高学历'" @confirm="education_confirm" @cancel="education_cancel" @close="education_close"></up-picker>
    <!-- 毕业日期 -->
    <up-datetime-picker v-model="graduation_date_time" :closeOnClickOverlay="true" :show="graduation_date_show" mode="date" :title="'请选择毕业日期'" @confirm="graduation_date_confirm" @cancel="graduation_date_cancel" @close="graduation_date_close" :minDate="-2209017943000"></up-datetime-picker>
    <!-- 离职日期 -->
    <up-datetime-picker v-model="lz_re_time" :closeOnClickOverlay="true" :show="lz_re_time_show" mode="date" :title="'请选择离职日期'" @confirm="lz_re_time_confirm" @cancel="lz_re_time_cancel" @close="lz_re_time_close" ></up-datetime-picker>
    <!-- 伤残等级 -->
    <up-picker :closeOnClickOverlay="true" :show="injury_show" :columns="injury_columns" :title="'请选择伤残等级'" @confirm="injury_confirm" @cancel="injury_cancel" @close="injury_close"> </up-picker>
    <!---选择户籍-->
    <up-picker :closeOnClickOverlay="true" :show="showIDType_show" :columns="showIDType_columns" :title="'请选择户籍类型'" @confirm="showIDType_confirm" @cancel="showIDType_cancel" @close="showIDType_close"></up-picker>
   
   

</template>

<script setup>
    import sheep from '@/sheep';
    import { ref, reactive } from 'vue';
    import { onLoad } from '@dcloudio/uni-app';
    import { baseUrl } from "@/sheep/config";
    import { formatDate } from '@/utils/fn.js';
    const { safeAreaInsets } = uni.getSystemInfoSync()
    const is_entry =  sheep.$store('user').userInfo.is_entry;
    const group_id = ref(0) //角色id
//获取邀请信息 （扫码之后获取） 
    onLoad((options) => {
        ids.value = options.ids
        postEntryInfoView()
        // FormData.share_id = options.share_id
        if(is_entry == 1){
            sheep.$router.back()
        }
    })
    	//获取邀请信息 （扫码之后获取） 
	const EntryInfoView = ref()
    const ids= ref()
	const postEntryInfoView = async()=>{
		let params ={
			ids:ids.value
		}
		const res = await sheep.$api.dispatch.postEntryInfoView(params);
		if(res.code == 1){
			EntryInfoView.value = res.data
            FormData.is_enrollment = EntryInfoView.value.is_enrollment
            FormData.is_contact = EntryInfoView.value.is_contact
            FormData.department_id = EntryInfoView.value.department_id
            group_id.value = EntryInfoView.value.group_id
            FormData.share_id = EntryInfoView.value.user_id
		}
		
	}
    // 表单数据
    const FormData = reactive({
        department_id:'',
        share_id:'',            // 分享人
        nativ_place:'',         // 籍贯
        householdaddress:'',    //户口所在地
        hukou_type:'0',          //户口类型
        address:'',             // 详细地址  
        marital_status:'0',      // 婚姻状况:0=未婚,1=已婚
        political_status:'0',    // 政治面貌:0=群众,1=中共党员,2=中共预备党员,3=共青团员
        graduate_school:'',     // 毕业院校
        education:'',           // 最高学历
        major:'',               // 专业
        graduation_date:'',     // 毕业日期
        is_enrollment:'',        //入职是否签署登记表
        is_contact:''     //是否签署电子劳务合同。0=否，1=是
    })
 
    const rules = {
        hukou_type:[
            {
                required:true,
                message:'请选择户籍类型',
            }
        ],
        address:[
            {
                required:true,
                message:'请输入详细地址',
            }
        ],
        political_status:[
            {
                required:true,
                message:'请选择政治面貌',
            }
        ]
    }
    // 紧急联系人表单内容
    const FormNextData = reactive({
 
        emergency_contact:'',//紧急联系人
        emergency_contact_relation:'',//紧急联系人关系
        emergency_contact_mobile:'',//紧急联系人电话
        emergency_contact_relation:''//紧急联系人地址
    })
    // 紧急联系人表单验证
     const  nextRules ={
       
            emergency_contact:[
                {
                    required:true,
                    message:'请输入紧急联系人',
                }
            ],
            emergency_contact_relation:[
            {
                    required:true,
                    message:'请输入紧急联系人关系',
                }
            ],
            emergency_contact_mobile:[
                {
                    required:true,
                    message:'请输入紧急联系人电话',
                }
            ],
            emergency_contact_address:[
                {
                    required:true,
                    message:'请输入紧急联系人地址',
                }
            ]
     }

    // 健康状况开始
  const FormNextTwoData = reactive({
       height:'',//身高
       weight:'',//体重
       eyesight:'good',//视力
       hearing:'good',//听力
       is_occupational_injury:0,//是否被认定工商或者残疾人证明
       is_disability:0,//是否呗劳动鉴定是否有伤残
       is_contagion:0,//是否有传染性疾病以及何疾病：填写“是”或“否”以及何疾病：
       recent_inspection:'',//最近6个月内所接受的医学治疗与医学检查：
       is_high_risk:0,//是否从事过井下、高空、高温、特别繁重体力劳动已经有毒有害工种：填写“是”或“否”
       disability_level:'',//伤残等级
       contagion_detail:'',//是否疾病输入内容
    })
    const  nextTwoRules ={
        recent_inspection:[
            {
                required:true,
                message:'请输入内容',
            }
        ],
    }

    // 前用人单位开始
    const FormNextFourData = reactive({
        resignation_time:'',//离职时间
        reason_to_leave:'',//离职原因
        is_confidentiality_agreement:0,//是与前用人单位约定了保密协议与竞业限制条款：填写“是”或“否
        is_legal_dispute:0,// 是否与前用人单位有未尽的法律事宜：填写“是”或“否”
    })
    const  nextFourRules ={
        resignation_time:[
            {
                required:false,
                message:'请选择离职时间',
            }
        ],
        reason_to_leave:[
            {
                required:false,
                message:'请输入离职原因',
            }
        ],
     }
    //  视力选择内容
    const eyesight_columns = ref([
            {
                name: '良好',
                value:'good',
                disabled: false
            },
            {
                name: '辅助',
                value:'bad',
                disabled: false
            },  
    ])
//  听力选择内容
const hearing_columns = ref([
            {
                name: '良好',
                value:'good',
                disabled: false
            },
            {
                name: '辅助',
                value:'bad',
                disabled: false
            },  
    ])
//  是否被认定工商或者残疾人证明
const is_occupational_injury_columns = ref([
        {
            name: '是',
            value:1,
            disabled: false
        },
        {
            name: '否',
            value:0,
            disabled: false
        },  
    ])
// 选择伤残等级
const injury_value = ref(0)
const injury_select =(item)=>{
    if (item.value == 1) {
        injury_show_input.value = true
        injury_value.value = 1
    }else{
        injury_show_input.value = false
        FormNextTwoData.disability_level = ''
    }
}
const injury_columns = ref([[1,2,3,4,5,6,7,8,9,10]])
const injury_show_input = ref(false)
const injury_show = ref(false)
const choose_injury =()=>{
    injury_show.value = true
}
const injury_confirm = (e)=>{
        FormNextTwoData.disability_level = e.value.join()
        injury_close()
}
        // 关闭
    const injury_close = () => {
        injury_show.value = false
    }
        // 取消
    const injury_cancel = () => {
        injury_close()
    }
//  是否被劳动能力鉴定委员会委员会鉴定为具有伤残等级以及何级伤残：填写“是”或“否”以及伤残等级
const is_disability_columns = ref([ 
        {
            name: '是',
            value:1,
            disabled: false
        },
        {
            name: '否',
            value:0,
            disabled: false
        },  
    ])
    const risk_show_input = ref(false)
    const risk_value = ref(0)
const risk_select =(item)=>{
    if (item.value == 1) {
        risk_show_input.value = true
        risk_value.value = 1
    }else{
        risk_show_input.value = false
        FormNextTwoData.contagion_detail = ''
    }
}
//  是否有传染性疾病以及何疾病：填写“是”或“否”以及何疾病：
const is_contagion_columns = ref([
        {
            name: '是',
            value:1,
            disabled: false
        },
        {
            name: '否',
            value:0,
            disabled: false
        },  
    ])
//  是否从事过井下、高空、高温、特别繁重体力劳动已经有毒有害工种：填写“是”或“否” 
const   is_high_risk_columns = ref([
        {
            name: '是',
            value:1,
            disabled: false
        },
        {
            name: '否',
            value:0,
            disabled: false
        },  
    ])
//  是与前用人单位约定了保密协议与竞业限制条款：填写“是”或“否
const  is_confidentiality_agreement_columns = ref([
        {
            name: '是',
            value:1,
            disabled: false
        },
        {
            name: '否',
            value:0,
            disabled: false
        },  
    ])
//  是否与前用人单位有未尽的法律事宜：填写“是”或“否”
    const is_legal_dispute_columns= ref([
        {
            name: '是',
            value:1,
            disabled: false
        },
        {
            name: '否',
            value:0,
            disabled: false
        },  
    ]) 
    // 婚姻状况
    const marital_status_title = ref('未婚') 
    const marital_status_show = ref(false)
    const marital_status_columns = ref([['未婚','已婚']])
        // 打开
    const marital_status_open = () => {
        marital_status_show.value = true
    }
        // 确定
    const marital_status_confirm = (e) => {
        marital_status_title.value = e.value.join()
        FormData.marital_status = e.indexs[0]
        marital_status_close()
    }
        // 关闭
    const marital_status_close = () => {
        marital_status_show.value = false
    }
        // 取消
    const marital_status_cancel = () => {
        marital_status_close()
    }

	//选择户籍类型
    const id_Type = ref('非农业') 
    const showIDType_show = ref(false)
    const showIDType_columns = ref([['非农业','农业']
	])
        // 打开
    const huokou_type_open = () => {
    
        showIDType_show.value = true
    }
        // 确定
    const showIDType_confirm = (e) => {
        id_Type.value = e.value.join()
        FormData.hukou_type = e.indexs[0]
   
        showIDType_close()
    }
        // 关闭
    const showIDType_close = () => {
        showIDType_show.value = false
    }
        // 取消
    const showIDType_cancel = () => {
        showIDType_close()
    }
    // 政治面貌
    const political_status_title = ref('群众') 
    const political_status_show = ref(false)
    const political_status_columns = ref([['群众','中共党员','中共预备党员','共青团员']])
        // 打开
    const political_status_open = () => {
        political_status_show.value = true
    }
        // 确定
    const political_status_confirm = (e) => {
        political_status_title.value = e.value.join()
        FormData.political_status = e.indexs[0]
        political_status_close()
    }
        // 关闭
    const political_status_close = () => {
        political_status_show.value = false
    }
        // 取消
    const political_status_cancel = () => {
        political_status_close()
    }

    // 最高学历
    const education_show = ref(false)
    const education_columns = ref([['中专及以下','大专','本科','研究生及以上']])
        // 打开
    const education_open = () => {
        education_show.value = true
    }
        // 确定
    const education_confirm = (e) => {
        FormData.education = e.value[0]
        education_close()
    }
        // 关闭
    const education_close = () => {
        education_show.value = false
    }
        // 取消
    const education_cancel = () => {
        education_close()
    }

    // 毕业日期
    const graduation_date_time = ref(946656000000);
    const graduation_date_show = ref(false)
        // 打开
    const graduation_date_open = () => {
        graduation_date_show.value = true
    }
        // 确定
    const graduation_date_confirm = (e) => {
        FormData.graduation_date = formatDate(e.value/1000)
        graduation_date_close()
    }
        // 关闭
    const graduation_date_close = () => {
        graduation_date_show.value = false
    }
        // 取消
    const graduation_date_cancel = () => {
        graduation_date_close()
    }
    // 离职日期
    const lz_re_time = ref(946656000000);
    const lz_re_time_show = ref(false)
        // 打开
    const lz_re_time_open = () => {
        lz_re_time_show.value = true
    }
        // 确定
    const lz_re_time_confirm = (e) => {
        FormNextFourData.resignation_time = formatDate(e.value/1000)
       lz_re_time_close()
    }
        // 关闭
    const lz_re_time_close = () => {
        lz_re_time_show.value = false
    }
        // 取消
    const lz_re_time_cancel = () => {
        lz_re_time_close()
    }

    const formRole = ref(null)
    // 下一步
    const nextFormRules = ref(1)
    const nextForm =()=>{
        formRole.value.validate().then(async (res)=> {
            if(res == true){
                nextFormRules.value = 2
            }
        }).catch((err) => {
            sheep.$helper.toast('请填写信息')
        })
    }
    // 紧急联系人验证
    const formNextRole = ref(null)
  const nextTowForm =()=>{
    formNextRole.value.validate().then(async (res)=> {
        if(res == true){
                nextFormRules.value = 3
            }
         
        }).catch((err) => {
            sheep.$helper.toast('请填写信息')
        })
  }
  const nextBackTowForm =()=>{
    nextFormRules.value = 1
    FormNextData.value = ''
}
//健康状况
const formNextTwoRole = ref(null)
const nextThreeForm =()=>{
    formNextTwoRole.value.validate().then(async (res)=> {
        if(res == true){
            if(!FormNextTwoData.disability_level && injury_value.value == 1){
                sheep.$helper.toast('请选择伤残等级')
            }else if(!FormNextTwoData.contagion_detail && risk_value.value ==1){
                sheep.$helper.toast('请输入疾病内容')
            }else{
                nextFormRules.value = 4
            }
         }
           
        })
  }
  const nextBackThreeForm =()=>{
    nextFormRules.value = 2
    FormNextTwoData.value = ''
}
// 前用人单位
const formNextFourRole = ref(null)
const params = ref({})
const entry_id = ref()
const nextFourForm =()=>{
    uni.$u.throttle(() => {
        params.value ={...FormData,...FormNextData,...FormNextTwoData,...FormNextFourData}
     
    formNextFourRole.value.validate().then(async (res)=> {
            let name = ''
            if(params.value.is_enrollment == 1 || params.value.is_contact == 1) {
                if(params.value.is_enrollment == 0 && params.value.is_contact == 1) {
                    name = 'contact'
                }
                if(params.value.is_enrollment == 1 && params.value.is_contact == 1) {
                    name = 'enrollment'
                }
                if(params.value.is_enrollment == 1 && params.value.is_contact == 0) {
                    name = 'enrollment'
                }  

            } else {
                params.value = { ...params.value , group_id: group_id.value}
            }
          
            uni.showLoading({ title: '加载中' });   
            const resust = await sheep.$api.dimission.entry_infoAddAPI(params.value);
            if(resust.code == 1 ){
                    // sheep.$router.go('/subpackage/user/user/Invite_colleague_pdf',{
                    // url:resust.data.url,
                    // params:JSON.stringify(params),
                    // entry:JSON.stringify(EntryInfoView.value),
                    // })
                entry_id.value = resust.data.id
                uni.hideLoading()
                if(params.value.is_enrollment == 1 || params.value.is_contact == 1) {
                   
                    setTimeout(() => {
                        sheep.$router.go('/subpackage/user/user/Invite_colleague_pdf',{
                            url:resust.data.url,
                            params:JSON.stringify(params.value),
                            entry:JSON.stringify(EntryInfoView.value),
                            name: name,
                            group_id: group_id.value,
                            id:entry_id.value,
                            share_id:FormData.share_id
                        })
                    },500)
                } else {
                    sheep.$store('user').getInfo();
                    sheep.$router.go('/pages/user/user/user')
                }
               
                // sheep.$store('user').getInfo();
            }else{
                sheep.$helper.toast(resust.msg);
            }
        // 
        //     sheep.$helper.toast(resust.msg);
        //     uni.showLoading({ title: '加载中' });   
        //     if(resust.code == 1 ){
        //         if(FormData.is_enrollment == 1){
        //             sheep.$router.go('/subpackage/user/user/Invite_colleague_pdf',{
        //             url:resust.data.url,
        //             params:JSON.stringify(params),
        //             entry:JSON.stringify(EntryInfoView.value),
        //             })
        //         }else{
        //             // sheep.$helper.toast(resust.msg);
        //             uni.showModal({
        //                     title: '提示',
        //                     content: resust.msg,
        //                     showCancel: false,
        //                     success: function (results) {
        //                         if (results.confirm) {
        //                             sheep.$router.go('/pages/user/user/user')
        //                         } 
        //                     }
        //                 });
        //         }
        //         sheep.$store('user').getInfo();
        //         uni.hideLoading()
                
        //     }else{
        //         sheep.$helper.toast(resust.msg);
        //     }
           
        }).catch((err) => {})
    })
  }
const nextBackFourForm =()=>{
    nextFormRules.value = 3
    FormNextFourData.value = ''
}


</script>

<style lang="scss" scoped>

 

    // 最大盒子
    .container {
        width: 100%;
        background-size: cover; /* 或 contain */
    }
    // 版心
    .area {
        width: calc(100% - 40rpx);
        margin: 0 20rpx;
    }

    // 表单盒子
    .form_box {
        width: calc(100% - 100rpx);
        padding:10rpx 30rpx 60rpx 30rpx;
        margin-top: 20rpx;
        border-radius: 16rpx;
        background-color: #FFFFFF;
        box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.05);
    }
    // 备注
    .remark {
        width: 100%;
        height: 100rpx;
        line-height: 100rpx;
        font-family: PingFangSC;
        color: $uni-text-color;
        font-weight: $uni-font-weight;
        font-size: 30rpx;
        font-style: normal;
        text-decoration: none;
    }
    // 表单标题
    .form_title{

      padding: 20rpx 0 0 0rpx;
      font-family: PingFangSC;
      color: $uni-text-color;
      font-weight: $uni-font-weight;
      font-size: 34rpx;
      height: 90rpx;
      line-height: 90rpx;
      position: relative;

      &::after {
        content: '';
        position: absolute;
        bottom: 23rpx;
        left: 10%;
        z-index: 9;
        width: 92rpx;
        height: 14rpx;
        border-radius: 10rpx;
        background-color: rgba(0, 56, 247, 0.5);
      }

    }
    :deep(.u-form-item__body){
        height: 70rpx;
        margin-bottom:20rpx;
        background-color: #F9FAFF;
        border-radius: 16rpx !important;
       
    }
    :deep(.u-form-item){
        text-align: right !important;
    }
    :deep(.u-textarea) {
        margin-right: 20rpx !important;
        font-size: 26rpx;
    }

    // uview 内部样式 输入内容右边间距
    :deep(.u-input__content__field-wrapper__field) {
        margin-right: 20rpx;
    }

    // uview 内部样式 label左边间距
    :deep(.u-form-item__body__left) {
        margin-left: 20rpx;
    }

    // uview 内部样式 label字体粗细
    :deep(.u-form-item__body__left__content__label) {
        font-weight: $uni-font-weight;
    }
    //长的文本
    .long_form{
        :deep(.u-form-item){
            
            &:nth-child(5){
                text-align: left !important;
                .u-form-item__body{
                    flex-direction: column !important;
                    height: auto !important;
                    .u-form-item__body__right__content{
                        margin-left: 20rpx !important;
                    }
                }
            }
            &:nth-child(6){
                text-align: left !important;
                .u-form-item__body{
                    flex-direction: column !important;
                    height: auto !important;
                    .u-form-item__body__right__content{
                        margin-left: 20rpx !important;
                    }
                   
                }
                .add_name{
                    background-color: #4d8bff;
                    height: 70rpx;
                    display: flex;
                    align-items: center;
                    padding-left: 20rpx;
                    color: #fff;
                    width: 370rpx;
                }
            }
            &:nth-child(7){
                text-align: left !important;
                .u-form-item__body{
                    flex-direction: column !important;
                    height: auto !important;
                    .u-form-item__body__right__content{
                        margin-left: 20rpx !important;
                    }
                }
            }
            &:nth-child(8){
                text-align: left !important;
                .u-form-item__body{
                    flex-direction: column !important;
                    height: auto !important;
                    .u-form-item__body__right__content{
                        margin-left: 20rpx !important;
                    }
                }
                .add_name {
                    width: 96%;
                    background-color: #fff;
                    border: 1rpx solid #0a5df8;
                    border-radius: 12rpx;
                    height: 70rpx;
                    display: flex;
                    align-items: center;
                    padding-left: 20rpx;
                    .u-input__content__field-wrapper__field{
                        text-align: left !important;
                    }
                }
            }
            &:nth-child(9){
                text-align: left !important;
                .u-form-item__body{
                    flex-direction: column !important;
                    height: auto !important;
                    .u-form-item__body__right__content{
                        margin-left: 20rpx !important;
                    }
                }
                .u-form-item__body__right__message{
                    margin-left: 530rpx !important;
                }
            }
        }
    }
 .long_two_form{
    :deep(.u-form-item){
            
            &:nth-child(3){
                text-align: left !important;
                .u-form-item__body{
                    flex-direction: column !important;
                    height: auto !important;
                    .u-form-item__body__right__content{
                        margin-left: 20rpx !important;
                    }
                }
            }
            &:nth-child(4){
                text-align: left !important;
                .u-form-item__body{
                    flex-direction: column !important;
                    height: auto !important;
                    .u-form-item__body__right__content{
                        margin-left: 20rpx !important;
                    }
                }
            }
        }
 }
 .displayflex{
    display: flex;
    justify-content: space-between;
    align-items: center;
 }

 .form_pages {
    padding: 20rpx 0 0 0;
    font-family: PingFangSC;
    color: $uni-text-color;
    font-weight: $uni-font-weight;
    font-size: 34rpx;
    margin-right: 30rpx;
}
.form_title_box {
    display: flex;
    align-items: center;
}
</style>


